package com.example.fangyh09.viewpager;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by fangyh09 on 8/12/2016.
 */
public class MyFragmentPageAdapter extends FragmentPagerAdapter {
    List<Fragment> fragList;
    List<String> titleList;
    public MyFragmentPageAdapter(FragmentManager fm, List<Fragment> fragList, List<String> titleList) {
        super(fm);
        this.fragList = fragList;
        this.titleList = titleList;
    }

    @Override
    public Fragment getItem(int position) {
        //return null;
        return fragList.get(position);
    }

    @Override
    public int getCount() {
       // return 0;
        return fragList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        //return super.getPageTitle(position);
        return titleList.get(position);
    }
}
































